import math
class HeightExcption (Exception):
    def __init__(self,value):
        self.value=value
    def __str__(self):
        return '异常信息：身高应处于0.3~2.5,输入的身高是:{}'\
            .format(self.value)
def computeBMI():
    height =float(input('请输入身高（m):'))
    if height<0.3 or height>2.5:
        raise HeightExcption(height)
    weight=float(input('请输入体重（kg）：'))
    BMI =weight /math.pow(height,2)
    if BMI<18.5:
        print('消瘦')
    elif BMI<24:
        print('正常')
    elif BMI<28:
        print('超重')
    else:
        print('肥胖')
try:
    computeBMI()
except HeightExcption as e:
    print(e)
except ValueError:
    print('输入的数据异常,请输入浮点数或整数！')